﻿namespace 依赖注入案例练习.ConfigService;

public class ReaderImpl:IConfigReader
{
    private IEnumerable<IConfig> _configs;

    public ReaderImpl(IConfig config, IEnumerable<IConfig> configs)
    {
        this._configs = configs;
    }
    public string GetValue(string name)
    {
        string value = null;
        foreach (var item in _configs)
        {
            string newValue = item.GetValue(name);
            if (newValue!=null)
            {
                value = newValue;
            }
        }

        return value;
    }
}